﻿using Abp.Domain.Entities;
using Abp.Domain.Entities.Auditing;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;

namespace LyyCMS.Core.Models
{
    /// <summary>
    /// 频道
    /// </summary>
    [Table("Channels")]
    public class Channel : Entity<int>, IHasCreationTime, IHasDeletionTime, IFullAudited
    {

        [Required(ErrorMessage ="{0}不能为空")]
        [DisplayName("频道名称")]
        [MinLength(2,ErrorMessage ="频道名称不能少于2个字符")]
        [MaxLength(10,ErrorMessage ="频道名称不能大于10个字符")]
        public string Title { get; set; }


        [DisplayName("调用名称")]
        public string UseName { get; set; }

        [DisplayName("是否启用")]
        [Column(TypeName = "bit")] //对于数据库字段类型 bit
        [DefaultValue(true)]
        public bool IsEnabled { get; set; }

        [DisplayName("开启评论")]
        [Column(TypeName = "bit")] 
        [DefaultValue(false)]
        public bool IsComment { get; set; }


        [DisplayName("开启相册")]
        [Column(TypeName = "bit")] 
        [DefaultValue(false)]
        public bool IsPics { get; set; }

        [DisplayName("开启附件")]
        [Column(TypeName = "bit")] 
        [DefaultValue(false)]
        public bool IsAnnex { get; set; }

        [Required(ErrorMessage ="{0}不能为空")]
        [DefaultValue(99)]
        [DisplayName("排序")]
        public int SortId { get; set; }


        /// <summary>
        /// 所属站点
        /// </summary>
        [DisplayName("所属站点")]
        public int SiteId { get; set; }

        /// <summary>
        /// 所属站点
        /// </summary>
        [DisplayName("所属站点")]
        public virtual Site Site { get; set; }

        //public Seo Seo { get; set; }

        /// <summary>
        /// 文章分类
        /// </summary>
        [DisplayName("所属文章分类")]
        public virtual ICollection<ArticleCategory> ArticleCategorys { get; set; }


        [DisplayName("创建时间")]
        public DateTime CreationTime { get; set; }
        [DisplayName("删除时间")]
        public DateTime? DeletionTime { get; set; }

        [DisplayName("已删除?")]
        public bool IsDeleted { get; set; }

        [DisplayName("创建人")]
        public long? CreatorUserId { get; set; }
        [DisplayName("修改人")]
        public long? LastModifierUserId { get; set; }
        [DisplayName("修改时间")]
        public DateTime? LastModificationTime { get; set; }
        [DisplayName("删除人")]
        public long? DeleterUserId { get; set; }
    }
}
